package com.upb.webserver.dao.mapper;

import com.upb.webserver.dao.entity.TbTransServer;
import com.upb.webserver.dao.entity.TbTransServerExample;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbTransServerMapper {

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbTransServerSqlProvider.class, method = "countByExample")
    long countByExample(TbTransServerExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @DeleteProvider(type = TbTransServerSqlProvider.class, method = "deleteByExample")
    int deleteByExample(TbTransServerExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @Delete({ "delete from tb_trans_server", "where id = #{id,jdbcType=INTEGER}" })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @Insert({ "insert into tb_trans_server (chain_id, server_type, ", "chain_type, application_id, ", "trans_ip, trans_port, ", "trans_base_url, gmt_create, ", "gmt_modified)", "values (#{chainId,jdbcType=INTEGER}, #{serverType,jdbcType=INTEGER}, ", "#{chainType,jdbcType=TINYINT}, #{applicationId,jdbcType=INTEGER}, ", "#{transIp,jdbcType=VARCHAR}, #{transPort,jdbcType=INTEGER}, ", "#{transBaseUrl,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, ", "#{gmtModified,jdbcType=TIMESTAMP})" })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insert(TbTransServer record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @InsertProvider(type = TbTransServerSqlProvider.class, method = "insertSelective")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insertSelective(TbTransServer record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbTransServerSqlProvider.class, method = "selectByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "server_type", property = "serverType", jdbcType = JdbcType.INTEGER), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "application_id", property = "applicationId", jdbcType = JdbcType.INTEGER), @Result(column = "trans_ip", property = "transIp", jdbcType = JdbcType.VARCHAR), @Result(column = "trans_port", property = "transPort", jdbcType = JdbcType.INTEGER), @Result(column = "trans_base_url", property = "transBaseUrl", jdbcType = JdbcType.VARCHAR), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP) })
    List<TbTransServer> selectByExample(TbTransServerExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @Select({ "select", "id, chain_id, server_type, chain_type, application_id, trans_ip, trans_port, ", "trans_base_url, gmt_create, gmt_modified", "from tb_trans_server", "where id = #{id,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "server_type", property = "serverType", jdbcType = JdbcType.INTEGER), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "application_id", property = "applicationId", jdbcType = JdbcType.INTEGER), @Result(column = "trans_ip", property = "transIp", jdbcType = JdbcType.VARCHAR), @Result(column = "trans_port", property = "transPort", jdbcType = JdbcType.INTEGER), @Result(column = "trans_base_url", property = "transBaseUrl", jdbcType = JdbcType.VARCHAR), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP) })
    TbTransServer selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbTransServerSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TbTransServer record, @Param("example") TbTransServerExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbTransServerSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") TbTransServer record, @Param("example") TbTransServerExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbTransServerSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TbTransServer record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @Update({ "update tb_trans_server", "set chain_id = #{chainId,jdbcType=INTEGER},", "server_type = #{serverType,jdbcType=INTEGER},", "chain_type = #{chainType,jdbcType=TINYINT},", "application_id = #{applicationId,jdbcType=INTEGER},", "trans_ip = #{transIp,jdbcType=VARCHAR},", "trans_port = #{transPort,jdbcType=INTEGER},", "trans_base_url = #{transBaseUrl,jdbcType=VARCHAR},", "gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},", "gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKey(TbTransServer record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert({ "<script>", "insert into tb_trans_server (chain_id, ", "server_type, chain_type, ", "application_id, trans_ip, ", "trans_port, trans_base_url, ", "gmt_create, gmt_modified)", "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.chainId,jdbcType=INTEGER}, ", "#{detail.serverType,jdbcType=INTEGER}, #{detail.chainType,jdbcType=TINYINT}, ", "#{detail.applicationId,jdbcType=INTEGER}, #{detail.transIp,jdbcType=VARCHAR}, ", "#{detail.transPort,jdbcType=INTEGER}, #{detail.transBaseUrl,jdbcType=VARCHAR}, ", "#{detail.gmtCreate,jdbcType=TIMESTAMP}, #{detail.gmtModified,jdbcType=TIMESTAMP})</foreach></script>" })
    int batchInsert(List<TbTransServer> list);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_server
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbTransServerSqlProvider.class, method = "getOneByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "server_type", property = "serverType", jdbcType = JdbcType.INTEGER), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "application_id", property = "applicationId", jdbcType = JdbcType.INTEGER), @Result(column = "trans_ip", property = "transIp", jdbcType = JdbcType.VARCHAR), @Result(column = "trans_port", property = "transPort", jdbcType = JdbcType.INTEGER), @Result(column = "trans_base_url", property = "transBaseUrl", jdbcType = JdbcType.VARCHAR), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP) })
    Optional<TbTransServer> getOneByExample(TbTransServerExample example);
}
